
    
    function loadFS(){
        window.requestFileSystem(1, 1, gotFS, fail);
    }

    function gotFS(fileSystem) {
        fileSystem.root.getFile("sample.txt", {create: true}, gotFileEntry, fail);
    }

    function gotFileEntry(fileEntry) {
        fileEntry.createWriter(gotFileWriter, fail);
    }

    function gotFileWriter(writer) {
        writer.onwrite = function(evt) {
            alert('success');
        };
        writer.onerror = function(){
        	alert('error');
        }
        writer.onwriteend = function(){
        	alert('end');
        }
        writer.write("some sample text");
    }

    function fail(error) {
        alert(error.code);
    }